<template>
  <div class="layout">
    <Topnav class="nav" />
    <div class="content">
      <aside v-if="menuVisible">
        <h2 class="gulu-doc gulu-lists-doc">文档</h2>
        <ol>
          <li><router-link to="/doc/intro">介绍</router-link></li>
          <li><router-link to="/doc/install">安装</router-link></li>
          <li><router-link to="/doc/get-started">使用</router-link></li>
        </ol>
        <h2 class="gulu-doc gulu-lists-list">组件列表</h2>
        <ol>
          <li><router-link to="/doc/switch">Switch 组件</router-link></li>
          <li><router-link to="/doc/button">Button 组件</router-link></li>
          <li><router-link to="/doc/dialog">Dialog 组件</router-link></li>
          <li><router-link to="/doc/tabs">Tabs 组件</router-link></li>
        </ol>
      </aside>
      <main>
        <router-view></router-view>
      </main>
    </div>
  </div>
</template>

<script lang="ts">
import { inject, Ref } from "vue";
import Topnav from "../components/Topnav.vue";
export default {
  components: { Topnav },
  setup() {
    const menuVisible = inject<Ref<boolean>>("menuVisible"); //get
    // console.log(menuVisible.value);
    return {
      menuVisible,
    };
  },
};
</script>
<style lang="scss" scoped>
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  > .nav {
    flex-shrink: 0;
  }
  > .content {
    flex-grow: 1;
    padding-top: 52px;
    padding-left: 240px;
    @media (max-width: 500px) {
      padding-left: 0;
    }
  }
}
.content {
  display: flex;
  > aside {
    flex-shrink: 0;
  }
  > main {
    background: white;
    height: auto;
    overflow: auto;
    flex-grow: 1;
    padding: 80px;
  }
}
aside {
  background: #ecf8ff;
  width: 240px;
  padding: 0px;
  position: fixed;
  top: 0;
  left: 0;
  padding-top: 100px;
  height: 100%;
  > h2 {
    margin-bottom: 4px;
    margin-top: 16px;
    padding: 0 40px;
    font-size: 25px;
  }
  > ol {
    > li {
      padding: 4px 0;
      > a {
        position: relative;
        height: 40px;
        color: #666;
        display: block;
        padding: 4px 50px;
        text-decoration: none;
      }
      > a:hover {
        color: rgb(64, 169, 255);
        text-decoration: none;
        border-bottom: none;
      }
      a.router-link-active{
        color: #fc5000;
      }
    }
  }
  // @media (max-width: 500px) {
  //   position: fixed;
  //   top: 0;
  //   left: 0;
  //   padding-top: 70px;
  // }
}
main {
  overflow: auto;
}
</style>